// only works if you have a GUI silly...maybe HC check too?
#include "\userconfig\axy_mobiledagr\axy_mobiledagr_config.hpp"
diag_log "Loading AXY MobileDAGR";

if (isDedicated) exitWith {};

waitUntil {!isNull(findDisplay 46)};
waituntil {!isnull player};

// Assign the server IP/port - defined in the axy_mobiledagr_config.hpp
"AXY_UDPSender" callExtension format["server=%1", AXY_MOBILEDAGR_HOST];

[] spawn {
	private ["_posData"];
	while {true} do
	{
		// Only send updates every n secs - defined in the axy_mobiledagr_config.hpp
		sleep AXY_MOBILEDAGR_UPDATES;
		_posData= getPosASL player;  // Note Eyeball's comment about sea level height...  https://community.bistudio.com/wiki/getPosASL
		// diag_log format['newpos={"x":%1,"y":%2,"alt":%3,"dir":%4,"spd":%5,"tme":%6}',_posData select 0, _posData select 1, _posData select 2,getDir player, speed player, date];	
		"AXY_UDPSender" callExtension format['newpos={"x":%1,"y":%2,"alt":%3,"dir":%4,"spd":%5,"tme":%6}',_posData select 0, _posData select 1, _posData select 2,getDir player, speed player, date];	
	};
};